package com.nbsaas.boot.site.rest.convert;

import com.nbsaas.boot.site.data.entity.DynamicPage;
import com.nbsaas.boot.site.api.domain.request.DynamicPageRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.site.data.entity.DynamicPageCatalog;

/**
* 请求对象转换成实体对象
*/

public class DynamicPageEntityConvert  implements Converter<DynamicPage, DynamicPageRequest> {

    @Override
    public DynamicPage convert(DynamicPageRequest source) {
        DynamicPage result = new DynamicPage();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getDynamicPageCatalog()!=null){
                    DynamicPageCatalog dynamicPageCatalog =new DynamicPageCatalog();
                    dynamicPageCatalog.setId(source.getDynamicPageCatalog());
                    result.setDynamicPageCatalog(dynamicPageCatalog);
                    }
        return result;
    }
}

